package com.blockchain.console.servlets.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.common.enums.IsPass;
import com.blockchain.console.service.user.UserManage;
import com.blockchain.console.service.user.entity.User;
import com.blockchain.framework.http.servlet.annotation.Right;
import com.blockchain.framework.service.ServiceSession;
import com.blockchain.util.parser.EnumParser;
import com.blockchain.util.parser.IntegerParser;

@Right(id = "C_USER_LIST_SH", name = "高级实名认证-审核")
public class UserGjrzSh extends AbstractUserServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		int userid = IntegerParser.parse(request.getParameter("userid"));
		UserManage userManage = serviceSession.getService(UserManage.class);
		User user = userManage.get(userid);
		request.setAttribute("user", user);
		forwardView(request, response, getClass());
	}

	@Override
	protected void processPost(final HttpServletRequest request, final HttpServletResponse response,
			final ServiceSession serviceSession) throws Throwable {
		UserManage userManage = serviceSession.getService(UserManage.class);
		int userid = IntegerParser.parse(request.getParameter("userid"));
		IsPass type = EnumParser.parse(IsPass.class, request.getParameter("type"));
		String bz = request.getParameter("bz");
		userManage.gjrzSh(userid, type, bz);
		sendRedirect(request, response, getController().getURI(request, UserGjrz.class));
	}

}
